package dice.sinanya.tools.makedata;

public class FullWidth2halfWidth {
    /**
     * 全角字符串转换半角字符串
     *
     * @param input 非空的全角字符串
     * @return 半角字符串
     */
    public static String fullWidth2halfWidth(String input) {
        char[] c = input.toCharArray();
        for (int i = 0; i < c.length; i++) {
            if (c[i] == '\u3000') {
                c[i] = ' ';
            } else if (c[i] > '\uFF00' && c[i] < '\uFF5F') {
                c[i] = (char) (c[i] - 65248);
            }
        }
        return new String(c);
    }
}
